﻿//------------------------------------------------------------------------------
// ╭─────────────────────────────╮
// │ ╭─╮     ╭─╮              TM │   ╠═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╣
// │ │ │     │ │                 │                                           ☺  
// │ │ ╰───╮ │ │ ╭─────╮ ╭─────╮ │     Name:Wedn.Net 路由配置         ♮ ♪ ♩
// │ │ ╭─╮ │ │ │ │ ╭─╮ │ │ ╭─╮ │ │                                    ♫ ♭      
// │ │ ╰─╯ │ │ │ │ ╰─╯ │ │ ╰─╯ │ │     Author:iceStone               ♬ ♪       
// │ └─────╯ └─╯ ╰─────╯ ╰───╮ │ │     Chinese:汪磊                              
// │                     ┌───╯ │ │                                              
// │                     ╰─────╯ │   ╠═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╬═╣
// ╰─────────────────────────────╯                                              
//------------------------------------------------------------------------------

using System;
using System.Web.Mvc;
using System.Web.Routing;

namespace Wedn.Net.Route
{
    /// <summary>
    /// 路由配置
    /// </summary>
    public class RouteConfig
    {
        /// <summary>
        /// 注册路由
        /// </summary>
        public static void RegisterRoutes()//RouteCollection routes)
        {
            var routes = RouteTable.Routes;
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            //routes.MapRoute(
            //    "Default", // Route name
            //    "{controller}/{action}/{id}", // URL with parameters
            //    new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            //);

            //routes.Add("Domain", new WednRoute(
            //    "{area}.wedn.me",
            //    "{controller}/{action}/{id}",
            //    new { controller = "home", action = "Index", id = UrlParameter.Optional }
            //));

            //var section = RouteCollectionExtensions.GetSection();

            //if (null == section)
            //    throw new Exception("还没有配置你的Route规则,请配置你的Route规则");
            //var routes = RouteTable.Routes;
            //routes.RegisterRoutes(section);
            //routes.MapRoute(
            //    "Admin", // 路由名称
            //    "{area}/{controller}/{action}/{id}", // 带有参数的 URL
            //    new { area = "Admin", controller = "Dashboard", action = "Index", id = UrlParameter.Optional },
            //    new[] { "Wedn.Net.Controller.Admin" }// 参数默认值
            //);
            //routes.Add("WednRoute", new WednRoute(
            //    "{lang}.wedn.net",     // Domain with parameters 
            //    "{controller}/{action}/{id}",    // URL with parameters 
            //    new RouteValueDictionary(new { lang = "cn", controller = "Test", action = "Index", id = "" })  // Parameter defaults 
            //));
            #region 转移至配置文件
            //routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            //routes.MapRoute(
            //    name: "Blog",
            //    url: "page/{page}",
            //    defaults: new { controller = "Blog", action = "Index", page = UrlParameter.Optional }
            //);

            ////routes.MapRoute(
            ////    name: "Default",
            ////    url: "{controller}/{action}/{id}",
            ////    defaults: new { controller = "Blog", action = "Index", id = UrlParameter.Optional }
            ////);

            ////routes.MapRoute(
            ////    name: "DefaultHtml",
            ////    url: "{controller}/{action}.html/{id}",
            ////    defaults: new { controller = "Blog", action = "Index", id = UrlParameter.Optional }
            ////);
            ////routes.MapRoute(
            ////    name: "DefaultAspx",
            ////    url: "{controller}/{action}.aspx/{id}",
            ////    defaults: new { controller = "Blog", action = "Index", id = UrlParameter.Optional }
            ////);
            ////routes.MapRoute(
            ////    name: "Front",
            ////    url: "{action}",
            ////    defaults: new { controller = "Blog", action = "Index", id = UrlParameter.Optional }
            ////); 
            #endregion
        }
    }
}